package com.iwinding.ladygg.ui.view;

import android.app.Activity;
import android.app.ProgressDialog;

/**
 * Created by hezhiyong on 2017/5/14.
 */

public class ProDialogCreator {

    private static ProDialogCreator sInstance;

    private Activity mContext;

    private ProgressDialog progressDialog;

    public static ProDialogCreator getInstance() {
        if (sInstance == null) {
            sInstance = new ProDialogCreator();
        }
        return sInstance;
    }

    public void initContext(Activity mContext) {
        this.mContext = mContext;
    }

    /**
     * Show dialog
     */
    public void showDialog(String message) {
        progressDialog = new ProgressDialog(mContext);
        progressDialog.setProgressStyle(ProgressDialog.STYLE_SPINNER);
        progressDialog.setCanceledOnTouchOutside(false);
        progressDialog.setMessage(message);
        progressDialog.show();
    }

    public void dismissDialog() {
        if (progressDialog == null) return;
        progressDialog.dismiss();
        progressDialog = null;
    }

}
